package Io;

import java.io.*;
import java.sql.SQLOutput;
import java.util.Scanner;

public class PWDemo {
    public static void main(String[] args) throws IOException {
        //低级流，以字节为输出
        FileOutputStream file = new FileOutputStream("pw.txt");
        //转换流，负责衔接低级流和缓冲流----将字符转换为字节
        OutputStreamWriter osw = new OutputStreamWriter(file);
        //缓冲流，块写文本加速，高级流,内部默认8192
        BufferedWriter bw = new BufferedWriter(osw);
        //按行输出字符，自动刷新
        PrintWriter pw = new PrintWriter(bw,true);
        Scanner scan = new Scanner(System.in);
        while(true){
            String l = scan.nextLine();
            if (!"exit".equals(l)){
                pw.println(l);
                pw.close();
            }else {
                break;
            }

        }



    }
}
